# 猜数字游戏扣金币

import random
num = random.randint(1,100)
coin = 5000
i = int(input("请输入一个数字："))

while coin >= 0:
    if i == num :
        coin = coin + 3000
        print("恭喜猜中，本轮幸运数字:{},还有{}枚金币".format(num,coin))
        break
    elif  i>num:
        coin = coin - 500
        print("数字大了,扣500金币，还有{}枚金币".format(coin))
        i = int(input("请输入一个数字："))
    elif i < num:
           coin = coin - 500
           print("数字小了，扣500金币，还有{}枚金币".format(coin))
           i = int(input("请输入一个数字："))
    else:
        print("请重新输入")
else:
    print("金币不足，退出游戏")